import Cookies from 'js-cookie'
import cache from '@/plugins/cache'

const TokenKey = 'Goosle-Admin-Token'

export function getToken() {
  // 适配中控，不确定规则的情况下就判断全部情况
  const token = Cookies.get(TokenKey) || cache.session.get('token') || cache.session.get('userToken') || cache.local.get('token') || cache.local.get('userToken')
  return token;
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}
